package com.example.mapper;

import com.example.entity.Account;
import com.example.entity.ZyzAdmin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 志愿者管理员Mapper
 */
public interface ZyzAdminMapper {

    /**
     * 添加
     * @param admin
     * @return
     */
    int insert(ZyzAdmin admin);

    /**
     * 删除
     * @param id
     * @return
     */
    @Delete("delete from zyz_admin where id =#{id}")
    int deleteById(Integer id);

    /**
     * 根据用户名查询
     * @param username
     * @return
     */
    @Select("select * from zyz_admin where username = #{username}")
    ZyzAdmin selectByUsername(String username);

    /**
     * 批量删除
     * @param ids
     * @return
     */
    int deleteByIds(String[] ids);

    /**
     * 修改
     * @param admin
     * @return
     */
    int updateById(ZyzAdmin admin);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    ZyzAdmin selectById(Integer id);

    /**
     * 查询所有
     * @param admin
     * @return
     */
    List<ZyzAdmin> selectAll(ZyzAdmin admin);

    @Select("select * from zyz_admin where username = #{username}")
    Account selectByUsername2(String username);

    @Select("select * from zyz_admin where id = #{id}")
    Account selectById2(Integer id);
}
